package cmpe.swe.purcom.model;

import java.util.Date;

public class FeedItem implements Comparable<FeedItem> {

	private Date insertionDate;
	private Long userID;
	private String userName;
	private Long activityID;
	private String activityName;
	private Long communityID;
	private String communityName;

	// stuffContribution (0), serviceContribution (1), eventAttendance (2)
	private Integer type;

	public FeedItem() {
		super();
	}

	public FeedItem(Integer type) {
		super();
		this.type = type;
	}

	public FeedItem(Date insertionDate, Long userID, String userName,
			Long activityID, String activityName, Long communityID,
			String communityName, Integer type) {
		super();
		this.insertionDate = insertionDate;
		this.userID = userID;
		this.userName = userName;
		this.activityID = activityID;
		this.activityName = activityName;
		this.communityID = communityID;
		this.communityName = communityName;
		this.type = type;
	}

	public Date getInsertionDate() {
		return insertionDate;
	}

	public void setInsertionDate(Date insertionDate) {
		this.insertionDate = insertionDate;
	}

	public Long getUserID() {
		return userID;
	}

	public void setUserID(Long userID) {
		this.userID = userID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Long getActivityID() {
		return activityID;
	}

	public void setActivityID(Long activityID) {
		this.activityID = activityID;
	}

	public String getActivityName() {
		return activityName;
	}

	public void setActivityName(String activityName) {
		this.activityName = activityName;
	}

	public Long getCommunityID() {
		return communityID;
	}

	public void setCommunityID(Long communityID) {
		this.communityID = communityID;
	}

	public String getCommunityName() {
		return communityName;
	}

	public void setCommunityName(String communityName) {
		this.communityName = communityName;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Override
	public int compareTo(FeedItem o) {
		Date myDate = this.insertionDate == null ? new Date(1)
				: this.insertionDate;
		Date itsDate = o.getInsertionDate() == null ? new Date(1) : o
				.getInsertionDate();

		return myDate.compareTo(itsDate);
	}
}
